#include <stdio.h>
#include "unistd.h"
#include "stdlib.h"
#include "sys/types.h"
#include "sys/wait.h"
#include "string.h"
#include "sys/mman.h"
#include "fcntl.h"
#include "mqueue.h"
#include "signal.h"

void sig_handle(int sig)
{
    if (sig == SIGINT)
    {
        printf("中断信号来了\n");
        exit(EXIT_SUCCESS);
    }
    else if (sig == SIGUSR1)
    {
        printf("用户自定义信号来了\n");
    }
}

int main(int argc, char const *argv[])
{
    /* 注册信号 */
    signal(SIGINT, sig_handle);

    signal(SIGUSR1, sig_handle);

    // 等待信号
    while (1)
    {
        pause();
    }

    return 0;
}
